<%@page contentType="text/html" pageEncoding="GBK" session="false"%><%@page
import="org.springframework.web.context.support.WebApplicationContextUtils,
org.springframework.web.context.WebApplicationContext,
cn.pconline.passport2.*"%><%
request.setCharacterEncoding("GBK");

String returnUrl = "";
String _return = request.getParameter("return");
String referer = request.getHeader("referer");
if (_return != null && !_return.trim().equals("")) {
	returnUrl = _return;
}else if (referer != null && !referer.trim().equals("")) {
	returnUrl = referer;
}

Passport passport = (Passport)WebApplicationContextUtils.
		getWebApplicationContext(application).getBean("passport");

cn.pconline.passport2.Session realmSession = null;
realmSession = passport.recognize(request, response);
if (realmSession != null) {
	passport.logout(request, response);
	returnUrl = passport.buildCrossDomainRedirectUrl(request, response, null, returnUrl);
}
if(returnUrl==null || returnUrl.length() == 0){
    returnUrl = "/";
}

%><script>location.href="<%=returnUrl %>"</script>